package jp.co.apl.haven_enquete.android.activity;

import jp.co.apl.haven_enquete.android.R;
import jp.co.apl.haven_enquete.android.dao.QuestionDataDao;
import android.content.Intent;
import android.net.Uri;
import android.test.ActivityInstrumentationTestCase2;
import android.test.suitebuilder.annotation.SmallTest;
import android.widget.TextView;

public class Main2Test extends ActivityInstrumentationTestCase2<Main> {

    public Main2Test() {
        super("jp.co.apl.haven_enquete", Main.class);
    }

    protected void setUp() throws Exception {
        super.setUp();
        Intent intent = new Intent();
        intent.setData(Uri
            .parse("content://jp.co.apl.haven_enquete/question/15"));
        setActivityIntent(intent);
    }

    @SmallTest
    public void testRun() {
        new QuestionDataDao(getActivity()).initDataFile();

        Main target = getActivity();

        TextView title = (TextView) target.findViewById(R.id.main_title);
        TextView text = (TextView) target.findViewById(R.id.main_text);

        assertEquals("テスト質問", title.getText().toString());
        assertEquals("テスト質問本文", text.getText().toString());
    }
}
